package com.example.contect001;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.deng.qu.untils.Tools;

import android.text.TextUtils;
import android.app.AlertDialog;
import android.app.TabActivity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.SimpleAdapter;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.os.Build;
import android.provider.CallLog;
import android.provider.CallLog.Calls;

public class MainActivity extends TabActivity {

	// 声明TabHost对象
	TabHost mTabHost;
	private final String[] mStrings = { "aaaaa", "bbbbb", "ccccc" };
	 private Context context;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fragment_main);
		context = this.getBaseContext();
		mTabHost = getTabHost();
		// 使用指定Tab样式
		setTabIndicator("通讯录", 1, new Intent(this, HomeActivity.class));
		setTabIndicator("打电话", 2, new Intent(this, PhoneActivity.class));
		setTabIndicator("联系人", 3, new Intent(this, ContactActivity.class));
		setTabIndicator("群组", 4, new Intent(this, GroupActivity.class));

		// 设置当前显示哪一个标签
		mTabHost.setCurrentTab(0);
	}

	private void setTabIndicator(String title, int nId, Intent intent) {
		// 使用指定Tab样式
		View view = LayoutInflater.from(this.mTabHost.getContext()).inflate(
				R.layout.tab_style, null);

		TextView text = (TextView) view.findViewById(R.id.tab_label);
		String strId = String.valueOf(nId);

		text.setText(title);

		// 创建一个新Tab
		TabHost.TabSpec localTabSpec = mTabHost.newTabSpec(strId)
				.setIndicator(view).setContent(intent);
		// 加载新Tab
		mTabHost.addTab(localTabSpec);
	}

}
